Skip to content

Out of range dates#200

Open
Philip-robinson wants to merge 6 commits into
dimastbk:masterfrom
cactus-bm:patch/out-of-range-dates
Open

Out of range dates#200
Philip-robinson wants to merge 6 commits into
dimastbk:masterfrom
cactus-bm:patch/out-of-range-dates

Conversation

@Philip-robinson

@Philip-robinson Philip-robinson commented May 20, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Bug Fixes

    • Out-of-range spreadsheet date/datetime values (beyond Python’s supported year range) no longer error; they now return ISO 8601 formatted strings (with correct T time separator for datetime).
  • Chores

    • Updated dependency declarations and added ignore rules for IDE project settings.
  • Tests

    • Added new pytest coverage verifying ISO string behavior for both XLSX and ODS across future/past date and datetime years.

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af903187-8d9f-4d9b-9484-4c35ab99d641

📥 Commits

Reviewing files that changed from the base of the PR and between f0a5be4 and 580fa31.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • src/types/cell.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/types/cell.rs

📝 Walkthrough

Walkthrough

The pull request adds out-of-range date handling for spreadsheet parsing. Rust code returns unsupported years as ISO 8601 strings, with tests covering future XLSX and past ODS dates. Project dependencies and IDE ignores are also updated.

Changes

Out-of-range date conversion and testing

Layer / File(s) Summary
Out-of-range date conversion logic
src/types/cell.rs
Checks date years during Python conversion and formats years outside (1000, 9999] as ISO 8601 strings.
Spreadsheet test coverage
tests/test_out_of_range_dates.py
Validates string types, ISO formatting, year boundaries, and time separators for XLSX future dates and ODS past dates.
Project test setup
requirements.txt, .gitignore
Adds editable installation and pinned pytest, pandas, and numpy requirements; ignores JetBrains .idea settings.

Estimated code review effort: 2 (Simple) | ~12 minutes

Poem

🐰 Dates hop far beyond Python’s gate,
So strings carry years both early and late.
XLSX and ODS join the spree,
With ISO timestamps for all to see.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: handling out-of-range dates/datetimes in Python conversion and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch patch/out-of-range-dates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/types/cell.rs`:
- Around line 33-34: The year bounds check incorrectly treats years 1..=1000 as
invalid; in the code around the date formatting where v.year() is checked (the
branch that sets formatted = v.format("%Y-%m-%d").to_string()), change the
condition from v.year() > 9999 || v.year() <= 1000 to use v.year() > 9999 ||
v.year() < 1 so that years in the valid Python datetime range [1,9999] are
preserved instead of being downgraded to string form.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c601af5a-b81b-4566-bf02-13740a3125a3

📥 Commits

Reviewing files that changed from the base of the PR and between a19fe18 and f0a5be4.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • tests/data/out_of_range_dates.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (5)
  • .gitignore
  • requirements.txt
  • src/types/cell.rs
  • tests/data/out_of_range_dates.ods
  • tests/test_out_of_range_dates.py

Comment thread src/types/cell.rs
@dimastbk

Copy link
Copy Markdown
Owner

Hi. According to 4.1.2.4 ISO8601 such dates should use extended representation (with sign and agreed additional years digits). I suggest to return a tuple of ints or just float/decimal in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants